package com.well.register.console.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.well.register.console.dao.JobParamHisMapper;
import com.well.register.console.domain.JobParamHis;
import com.well.register.console.service.JobParamHisService;
import org.springframework.stereotype.Service;


/**
 * <p>
 * job service impl
 * </p>
 *
 * @author weedo
 * @since 2022/8/7
 */

@Service
public class JobParamHisServiceImpl extends ServiceImpl<JobParamHisMapper, JobParamHis> implements JobParamHisService {

    @Override
    public JobParamHis getMaxVersionHisByParamKey(String paramKey) {
        QueryWrapper<JobParamHis> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("param_key", paramKey);
        queryWrapper.orderByDesc("version");
        queryWrapper.last("limit 1");
        return this.getOne(queryWrapper);
    }
}
